home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-06-02 | 58.8 KB | 1,802 lines |
-
-
-
- Windows Standard Communications
-
- Library for Visual Basic
-
- (WSC4VB)
-
-
- REFERENCE MANUAL
-
-
-
- Version 2.4
-
- June 1, 1999
-
-
-
-
- This software is provided as-is.
- There are no warranties, expressed or implied.
-
-
-
-
- Copyright (C) 1999
- All rights reserved
-
-
-
-
- MarshallSoft Computing, Inc.
- Post Office Box 4543
- Huntsville AL 35815
-
- Voice : 256-881-4630
- FAX : 256-880-0925
- email : info@marshallsoft.com
- web : www.marshallsoft.com
-
-
- _______
- ____|__ | (R)
- --+ | +-------------------
- | ____|__ | Association of
- | | |_| Shareware
- |__| o | Professionals
- --+--+ | +---------------------
- |___|___| MEMBER
-
-
-
-
- MARSHALLSOFT is a registered trademark of MarshallSoft Computing.
-
-
-
- WSC4VB Reference Manual Page 1
-
- C O N T E N T S
-
-
-
- Chapter Page
-
- Table of Contents.............................2
-
- WSC Functions.................................4
-
- SioBaud....................................4
- SioBrkSig..................................4
- SioCTS.....................................5
- SioDCD.....................................5
- SioDone....................................6
- SioDSR.....................................6
- SioDTR.....................................7
- SioEvent...................................7
- SioFlow....................................8
- SioGetc....................................8
- SioGets....................................9
- SioInfo....................................9
- SioParms..................................10
- SioPutc...................................10
- SioPuts...................................11
- SioRead...................................11
- SioReset..................................12
- SioRI.....................................12
- SioRTS....................................13
- SioRxClear................................13
- SioRxQue..................................14
- SioStatus.................................14
- SioTimer..................................15
- SioTxClear................................15
- SioTxQue..................................16
- SioUnGetc.................................16
- SioWinError...............................17
-
- WSC Error Codes..............................17
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 2
-
- C O N T E N T S
-
- (continued)
-
-
-
- Chapter Page
-
- Modem I/O Functions..........................18
-
- mioBreak..................................18
- mioDriver.................................18
- mioQuiet..................................19
- mioResult.................................19
- mioSendTo.................................20
- mioWaitFor................................20
-
- Xmodem/Ymodem Driver (XYDRV) Functions
-
- xyAbort...................................21
- xyAcquire.................................21
- xyDebug...................................22
- xyDriver..................................22
- xyGetFileName.............................23
- xyGetMessage..............................23
- xyGetParameter............................24
- xyRelease.................................24
- xySetParameter............................25
- xyStartRx.................................25
- xyStartTx.................................26
-
- XYDRV Error Codes............................26
-
- ASCII Driver (ASDRV) Functions
-
- ascAbort..................................27
- ascDriver.................................27
- ascGetMessage.............................28
- ascGetParameter...........................28
- ascInit...................................29
- ascStartRx................................29
- ascStartTx................................30
-
- ASDRV Error Codes............................30
-
- NOTES: DefLng is assumed for all functions unless otherwise declared.
- Also note that all arguments are passed by value except for strings.
- When in doubt about a function, refer to the declarations in
- WSC32.BAS
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 3
-
- +-------------+-----------------------------------------------------+
- | SioBaud | Sets the baud rate. |
- +-------------+-----------------------------------------------------+
-
-
- Syntax Function SioBaud(ByVal Port, ByVal BaudCode) As Long
- ' Port : Port selected.
- ' BaudCode : Baud code or actual baud rate.
-
- Remark The SioBaud Function sets the baud rate without resetting
- the port. It is used to change the baud rate after calling
- SioReset.
-
- SioBaud may be called with either the actual baud rate value
- or one of the baud rate codes as follows:
-
- Code Rate Name Code Rate Name
- 0 300 Baud300 5 9600 Baud9600
- 1 600 Baud600 6 19200 Baud19200
- 2 1200 Baud1200 7 38400 Baud38400
- 3 2400 Baud2400 8 57600 Baud57600
- 4 4800 Baud4800 9 115200 Baud115200
-
- Return IE_BADID : No such port.
- IE_BAUDRATE : Unsupported baud rate.
-
- Other See SioReset.
-
-
-
- +-------------+-----------------------------------------------------+
- | SioBrkSig | Asserts, cancels, or detects BREAK signal. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioBrkSig(ByVal Port, ByVal PortCmd) As Long
- ' Port : Port selected.
- ' Cmd : ASSERT, CANCEL, or DETECT.
-
- Remark The SioBrkSig Function controls the BREAK bit in the line
- status register. The legal commands are:
-
- ASSERT_BREAK : ASC("A") to assert BREAK
- CANCEL_BREAK : ASC("C") to cancel BREAK
- DETECT_BREAK : ASC("D") to detect BREAK
-
- ASSERT_BREAK, CANCEL_BREAK, and DETECT_BREAK are defined in
- WSC4VB.BAS.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- WSC_RANGE : Illegal command. Expected "A", "C", or "D".
- >0 : BREAK signal detected (DETECT command only)
-
- Other None.
-
-
-
-
- WSC4VB Reference Manual Page 4
-
- +-------------+-----------------------------------------------------+
- | SioCTS | Reads the Clear to Send (CTS) modem status bit. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioCTS(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioCTS Function is used to detect if CTS (Clear To Send)
- is set (1) or clear (0). Some Windows Win16 COMM drivers
- cannot read the CTS bit correctly!
-
- The CTS line is used by some error correcting modems to
- implement hardware flow control. CTS is dropped by the modem
- to signal the computer not to send data and is raised to
- signal the computer to continue.
-
- Refer to the RS232/485 Serial Communications User's Manual
- (ASYNC.TXT) for a discussion of flow control.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- 0 : CTS is clear.
- >0 : CTS is set.
-
- Other See SioFlow, SioDSR, SioRI, and SioDCD.
-
-
-
-
-
-
-
-
-
-
-
-
-
- +-----------+-------------------------------------------------------+
- | SioDCD | Reads the Data Carrier Detect (DCD) modem status bit. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function SioDCD(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioDCD Function is used to read the Data Carrier Detect
- (DCD) modem status bit.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- 0 : DCD is clear.
- >0 : DCD is set.
-
- Other See SioDSR, SioCTS, and SioRI.
-
-
-
-
- WSC4VB Reference Manual Page 5
-
- +-------------+-----------------------------------------------------+
- | SioDone | Terminates further serial processing. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioDone(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioDone Function terminates further serial processing,
- allowing other applications to use the port.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
-
- Other See SioReset.
-
-
-
-
-
-
-
-
-
- +-------------+-----------------------------------------------------+
- | SioDSR | Reads the Data Set Ready (DSR) modem status bit. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioDSR(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioDSR Function is used to detect if DSR (Data Set Ready)
- is set (1) or clear (0). Some Windows Win16 COMM drivers
- cannot read the DSR bit correctly!
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- 0 : DSR is clear.
- >0 : DSR is set.
-
- Other See SioCTS, SioRI, and SioDCD.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 6
-
- +-------------+-----------------------------------------------------+
- | SioDTR | Set, clear, or read Data Terminal Ready (DTR). |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioDTR(ByVal Port, ByVal Cmd) As Long
- ' Port : Port selected.
- ' Cmd : DTR command (see below).
-
- Remark The SioDTR Function controls the Data Terminal Ready (DTR) bit
- in the modem control register. DTR should always be set when
- communicating with a modem. Commands (defined in WSC4VB.BAS):
-
- SET_LINE : ASC("S") to set DTR (ON)
- CLEAR_LINE : ASC("C") to clear DTR (OFF)
- READ_LINE : ASC("R") to read DTR
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- WSC_RANGE : Not one of "S", "C", or "R".
- 0 : DTR is OFF (READ_LINE Command).
- >0 : DTR is ON (READ_LINE Command).
-
- Other See SioRTS.
-
-
- +-----------+-------------------------------------------------------+
- | SioEvent | Efficiently waits for serial event. |
- +-----------+-------------------------------------------------------+
-
- SYNTAX Function SioEvent(ByVal Port, ByVal Mask)
- ' Port : Port selected.
- ' Mask : Event Mask (see below).
-
- REMARK The SioEvent function (WIN32 only) waits (blocks) until the
- condition specfied in 'Mask' is satisfied. Multiple
- conditions can be OR'ed together. The event masks are:
-
- EV_RXCHAR : A character was received.
- EV_BREAK : A break signal was received.
- EV_CTS : The CTS line changed states.
- EV_DSR : The DST line changed states.
- EV_ERR : An error was detected.
- EV_RLSD : The DCD line has changed states.
- EV_RING : The RI line has been set.
- EV_TXEMPTY : The TX queue has become empty.
-
- RETURN SioEvent does not return until the specified event occurs.
-
- OTHER See SioRead.
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 7
-
- +------------+------------------------------------------------------+
- | SioFlow | Sets flow control. |
- +------------+------------------------------------------------------+
-
- Syntax Function SioFlow(ByVal Port, ByVal Cmd) As Long
- ' Port : Port selected.
- ' Cmd : Class of flow control (see below).
-
- Remark The SioFlow Function is used to enable or disable hardware
- flow control. Hardware flow control uses RTS and CTS to
- control data flow between the modem and the computer. To
- enable flow control, call SioFlow with Cmd set to:
-
- Cmd Flow Control
- ASC("H") Hardware (RTS/CTS) flow control.
- ASC("S") Software (XON/XOFF) flow control.
- ASC("N") No flow control.
-
- In order for hardware flow control to work correctly, your
- modem must also be configured to work with hardware flow
- control, and your computer to modem cable must have RTS and
- CTS wired straight through. If you enable hardware flow
- control, do not modify the RTS line (by calling SioRTS). Flow
- control is disabled after resetting a port.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- WSC_RANGE : Cannot recognize Cmd.
- -1 : Flow control disabled.
- >0 : Flow control enabled.
-
- Other See SioPutc
-
-
- +------------+------------------------------------------------------+
- | SioGetc | Reads the next character from the serial line. |
- +------------+------------------------------------------------------+
-
- Syntax Function SioGetc(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioGetc Function reads a byte from the selected serial
- port. WSC_NO_DATA (-100) is returned if no byte is available.
-
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- WSC_NO_DATA : If timed out (no data available).
- >= 0 : Character read.
-
- Other See SioUnGetc and SioGets.
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 8
-
- +------------+------------------------------------------------------+
- | SioGets | Reads the next byte buffer from the serial line. |
- +------------+------------------------------------------------------+
-
- Syntax Function SioGets(ByVal Port, ByVal Buffer As String,
- ByVal Cnt) As Long
- ' Port : Port selected.
- ' Buffer : Receive buffer.
- ' Cnt : Number bytes wanted.
-
- Remark The SioGets Function reads the smaller of the number of bytes
- wanted (Cnt) and the number of bytes in the receive buffer. A
- zero is return if no bytes are read.
-
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- >= 0 : Number of characters actually read.
-
- Other See SioUnGetc and SioPutc.
-
-
- +-------------+-----------------------------------------------------+
- | SioInfo | Returns WSC4VB library information. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioInfo(ByVal Cmd) As Long
- ' Cmd : Command (See below).
-
- Remark The SioInfo Function returns an integer code corresponding to
- the Cmd as follows.
-
- Command SioInfo returns
- ASC( "V") Library version number. For example,
-
- ' display WSC version
- Version = SioInfo(ASC("V"))
- C = Hex$(&HF And Version)
- Version = Version / 16
- B = Hex$(&HF And Version)
- Version = Version / 16
- A = Hex$(&HF And Version)
- PRINT "WSC Version " + A + "." + B + "." + C
-
- Return See remarks above.
- -1 : Cannot recognize Cmd.
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 9
-
- +-------------+-----------------------------------------------------+
- | SioParms | Sets parity, stop bits, and word length. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioParms(ByVal Port, ByVal Parity,
- ByVal StopBits, ByVal DataBits) As Long
- ' Port : Port selected.
- ' Parity : Parity code.
- ' StopBits : Stop bits code.
- ' DataBits : Word length code.
-
- Remark The SioParms Function sets the parity, stop bits, and word
- length. If the default parity (none), stop bits (1), or word
- length (8) is not acceptable, then they can be changed by
- calling SioParms. SioParms can be called either before or
- after calling SioReset. See file WSC4VB.BAS.
-
- Use the constant values defined in WSC4VB.BAS to minimize the
- chance of passing an incorrect parameter value.
-
- Parity : NoParity, OddParity, EvenParity,
- MarkParity, SpaceParity.
- StopBits : OneStopBit, One5StopBits, TwoStopBits.
- DataBits : WordLength7, WordLength8.
-
- Return IE_BADID : No such port.
- IE_BYTESIZE : Word length not supported.
- WSC_RANGE : Parameter out of range.
-
- Other See SioReset.
-
-
- +-------------+-----------------------------------------------------+
- | SioPutc | Transmit a character over a serial line. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioPutc(ByVal Port, ByVal Chr) As Long
- ' Port : Port selected.
- ' Chr : Character to send.
-
- Remark The SioPutc Function copies the character to the transmit
- queue for subsequent transmission.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- 0 : No error.
-
- Other See SioGetc and SioFlow.
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 10
-
- +-------------+-----------------------------------------------------+
- | SioPuts | Transmits a byte buffer over a serial line. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioPuts(ByVal Port, ByVal Buffer As String,
- ByVal Cnt) As Long
- ' Port : Port selected.
- ' Buffer : String of bytes to transmit.
- ' Cnt : Bytes in Buffer to send.
-
- Remark The SioPuts Function copies the characters to the transmit
- queue for subsequent transmission.
-
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- >= 0 : The number of bytes actually transmitted.
-
- Other See SioGetc and SioFlow.
-
-
-
- +-------------+-----------------------------------------------------+
- | SioRead | Read any UART port register. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioRead(ByVal Port, ByVal Register) As Long
- ' Port : Port selected.
- ' Register : UART register [0 through 6].
-
- REMARK The SioRead function reads any of the 7 I/O ports directly,
- by-passing the Windows API. Only for COM1 through COM4.
-
- Note that all modem and/or line status bits can also be read
- using SioDTR, SioRTS, SioDCD, SioRI, SioDSR, and SioCTS. Refer
- to the RS232/485 Serial Communications User's Manual
- (ASYNC.TXT) for a description of the UART registers.
-
- Return IE_BADID : No such port.
- IE_OPEN : Already open.
- else : Value of selected register.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 11
-
- +-------------+-----------------------------------------------------+
- | SioReset | Initialize a serial port for processing. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioReset(ByVal Port, ByVal RxQueSize,
- ByVal TxQueSize) As Long
- ' Port : Port selected.
- ' RxQueSize : Receive queue size.
- ' TxQueSize : Transmit queue size.
-
- Remark The SioReset Function initializes the selected serial port.
- SioReset should be called before making any other calls to
- WSC4VB. SioReset uses the parity, stop bits, and word length
- value previously set if SioParm was called, otherwise the
- default values (see SioParm) are used.
-
- Return IE_BADID : No such port.
- IE_OPEN : Already open.
- IE_MEMORY : Cannot allocate memory.
- IE_HARDWARE : Hardware error.
-
- Other See SioBaud, SioParms, and SioDone.
-
- +-------------+-----------------------------------------------------+
- | SioRI | Reads the Ring Indicator (RI) modem status bit. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioRI(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioRI Function is used to read the Ring Indicator (RI)
- modem status bit.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- 0 : RI is clear.
- >0 : RI is set (RING has occurred).
-
- Other See SioDSR, SioCTS, and SioDCD.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 12
-
- +-------------+-----------------------------------------------------+
- | SioRTS | Sets, clears, or reads the Request to Send (RTS). |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioRTS(ByVal Port, ByVal Cmd) As Long
- ' Port : Port selected.
- ' Cmd : RTS command (SET, CLEAR, or READ).
-
- Remark The SioRTS Function controls the Request to Send (RTS bit in
- the modem control register.
-
- The RTS line is used by some error correcting modems to
- implement hardware flow control. RTS is dropped by the
- computer to signal the modem not to send data, and is raised
- to signal the modem to continue. RTS should be set when
- communicating with a modem unless Flow Control is being used.
-
- Refer to the RS232/485 Serial Communications User's Manual
- (ASYNC.TXT) for a discussion of flow control. Commands (see
- WSC4VB.BAS) are:
-
- SET_LINE ASC("S") : set RTS (ON)
- CLEAR_LINE ASC("C") : clear RTS (OFF)
- READ_LINE ASC("R") : read RTS
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
- WSC_RANGE : Command is not one of "S", "C", or "R".
- 0 : RTS is OFF ("R" command).
- >0 : RTS is ON ("R" command).
-
- Other See SioFlow and SioDTR.
-
- +------------+------------------------------------------------------+
- | SioRxClear | Clears the receive buffer. |
- +------------+------------------------------------------------------+
-
- Syntax Function SioRxClear(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioRxClear Function will delete any characters in the
- receive buffer for the specified port. After execution, the
- receive buffer will be empty.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
-
- Other See SioRxQue.
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 13
-
- +-------------+-----------------------------------------------------+
- | SioRxQue | Returns the number of bytes in the receive queue. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function SioRxQue(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioRxQue Function will return the number of characters in
- the receive queue at the time of the call.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
-
- Other See SioTxQue.
-
-
- +------------+------------------------------------------------------+
- | SioStatus | Returns the serial port status. |
- +------------+------------------------------------------------------+
-
- Syntax Function SioStatus(ByVal Port, ByVal Mask) As Long
- ' Port : Port selected.
- ' Mask : Error mask.
-
- Remark The SioStatus Function returns the serial port error status
- corresponding to the Mask argument. The numerical values of
- the PortMask constants are defined in WSC4VB.BAS.
-
- WSC_RXOVER : The receive queue overflowed.
- WSC_OVERRUN : An incoming byte was overwritten.
- WSC_PARITY : A parity error was detected (incoming byte)
- WSC_FRAME : A framing error was detected (incoming byte)
- WSC_BREAK : A break signal was detected.
- WSC_TXFULL : The transmit queue is full.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 14
-
- +-----------+-------------------------------------------------------+
- | SioTimer | Returns the system time in milliseconds. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function SioTimer() As Long
-
- Remark The SioTimer function returns the system in milliseconds. Its
- primary purpose is to compute the time between two events.
-
- Return The system time in milliseconds.
-
-
-
-
-
-
- +------------+------------------------------------------------------+
- | SioTxClear | Clears the transmitter buffer. |
- +------------+------------------------------------------------------+
-
- Syntax Function SioTxClear(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioTxClear Function will delete any characters in the
- transmit buffer for the specified port.
-
- Once this function is called, any character in the transmit
- buffer (put there by SioPutc) will be lost and therefore not
- transmitted.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
-
- Other See SioTxQue.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 15
-
- +------------+------------------------------------------------------+
- | SioTxQue | Returns the number of bytes in the transmit queue. |
- +------------+------------------------------------------------------+
-
- Syntax Function SioTxQue(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The SioTxQue Function will return the number of characters in
- the transmit queue at the time of the call.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
-
- Other See SioRxQue.
-
-
-
-
-
-
-
-
-
-
- +------------+------------------------------------------------------+
- | SioUnGetc | "Ungets" the last character read with SioGetc(). |
- +------------+------------------------------------------------------+
-
- Syntax Function SioUnGetc(ByVal Port, ByVal Ch) As Long
- ' Port : Port selected.
- ' Ch : Character to unget.
-
- Remark The SioUnGetc Function returns (.pushes.) the character back
- into the serial input buffer. The character pushed will be
- the next character returned by SioGetc. Only one character
- can be pushed back. This Function works just like the
- 'ungetc' Function in the C language.
-
- Return IE_NOPEN : Port not opened. Call SioReset first.
- IE_BADID : No such port.
-
- Other See SioReset.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 16
-
- +--------------+----------------------------------------------------+
- | SioWinError | Return last Win32 error code & message text. |
- +--------------+----------------------------------------------------+
-
- SYNTAX Function SioWinError(ByVal Buffer As String,
- ByVal Size As Long) As Long
- ' Buffer : Pointer to messages buffer.
- ' Size : Size of buffer.
-
- REMARK The SioWinError returns the last Win32 error code. If Buffer
- is not NULL, it will also copy the corresponding text message
- into 'Buffer' of size 'Size'.
-
- RETURN The Win32 numeric error code.
-
-
-
-
- WSC Error Codes
-
-
- +---------------+---------------------------------------------+
- | WSC_NO_DATA | No incoming serial data is available. |
- | WSC_RANGE | A parameter is out of range. |
- | WSC_ABORTED | The shareware version of WSC corrupted. |
- | WSC_WIN32ERR | Win32 system error. |
- +---------------+---------------------------------------------+
- | IE_BADID | No such port. |
- | IE_OPEN | Port already opened. |
- | IE_NOPEN | Port not opened. Call SioReset first. |
- | IE_MEMORY | Cannot allocate memory for queues. |
- | IE_DEFAULT | Error in default parameters. |
- | IE_HARDWARE | Hardware not present. |
- | IE_BYTESIZE | Unsupported byte size. |
- | IE_BAUDRATE | Unsupported baud rate. |
- +---------------+---------------------------------------------+
-
-
- The WSC_ABORTED error occurs in the shareware version only if there
- is a problem displaying the shareware screen.
-
- The WSC_WIN32ERR error code is returned only for Win32 system errors.
- Call SioWinError to retrieve the error message.
-
- See Error.BAS to display the text of the error message.
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 17
-
- +-----------+-------------------------------------------------------+
- | mioBreak | Aborts the Modem I/O state driver. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function mioBreak(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark Forces the MIO driver to the IDLE state, abandoning any work
- in progress (if any). Used to abort mioSendTo, mioQuiet, and
- mioWaitFor functions.
-
- Return MIO_IDLE.
-
-
-
-
-
-
-
- +------------+------------------------------------------------------+
- | mioDriver | Modem I/O state driver. |
- +------------+------------------------------------------------------+
-
- Syntax Function mioDriver(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark Executes the next state of any previously started MIO Function
- such as mioSendTo, mioWaitFor, and mioQuiet. Returns MIO_IDLE
- (defined in MIO32.BAS) if ready not running, MIO_RUNNING if
- running, and anything else is a character from the modem that
- can be displayed if wanted.
-
- Return MIO_IDLE : if the driver is ready for the next mioSendTo,
- mioWaitFor, or mioQuiet.
- MIO_RUNNING : if the driver is not idle.
- <else> : if the driver is not idle, and the returned
- character was received from the modem.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 18
-
- +-----------+-------------------------------------------------------+
- | mioQuiet | Waits for Modem I/O state driver. | *
- +-----------+-------------------------------------------------------+
-
- Syntax Function mioQuiet(ByVal Port, ByVal Wait As Long) As Long
- ' Port : Port selected.
- ' Wait : Wait in milliseconds.
-
- Remark The mioQuiet Function waits for continuous quiet [no incoming
- serial data] of 'Wait' milliseconds before returning. Any
- incoming character while mioQuiet is running is lost.
-
- Return TRUE.
-
-
-
-
- +------------+------------------------------------------------------+
- | mioResult | Returns result of last mioWaitFor. |
- +------------+------------------------------------------------------+
-
- Syntax Function mioResult(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The mioResult Function returns the result of the last
- mioWaitFor Function. This Function should not be called until
- the driver returns MIO_IDLE. See the remarks section of the
- mioWaitFor Function for an example.
-
- Return 0 : False (last WaitFor not matched)
- !0 : '0' if first substring matched, '1' if second substring
- matched, etc.
-
- Other See mioWaitFor.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 19
-
- +-----------+-------------------------------------------------------+
- | mioSendTo | Sends string to modem. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function mioSendTo(ByVal Port, ByVal Pace,
- ByVal Text As String) As Long
- ' Port : Port selected.
- ' Pace : The inter-character delay in milliseconds.
- ' Text : The string to send.
-
- Remark The mioSendTo Function sends the characters in the string
- 'Text' to serial output. There is a delay of 'Pace'
- milliseconds between characters.
-
- Three characters in 'Text' are interpreted as:
-
- '^' : next character is control char (^A for 0x01)
- '!' : replaced with carriage return.
- '~' : removed from string (delay 1/2 second).
-
- Return TRUE.
-
-
-
- +-------------+-----------------------------------------------------+
- | mioWaitFor | Waits for continuous quiet. |
- +-------------+-----------------------------------------------------+
-
- Syntax Function mioWaitFor(ByVal Port, ByVal Wait,
- ByVal Text As String) As Long
-
- ' Port : Port selected.
- ' Wait : Total time to wait for response (milliseconds).
- ' Text : The expected response string.
-
- Remark The mioWaitFor Function waits for characters from serial
- input that match the string 'Text'. A total of 'Wait'
- milliseconds are allowed before timing out and returning FALSE
- (0). The string comparison is NOT case sensitive.
-
- For example, to wait up to one minute for 'CONNECT', 'NO
- CARRIER', or 'BUSY' from the modem after dialing a number.
-
- Code = mioWaitFor(ByVal Port,60000,'CONNECT|NO CARRIER|BUSY')
-
- The Function mioDriver() must be called until MIO_IDLE is
- returned. Then mioResult() is called to get the result of the
- mioWaitFor. A value of 0 indicates that neither 'CONNECT',
- 'BUSY', nor 'NO CARRIER' was received. A non-zero value
- indicates that one of the three sub-strings was received. A
- '0' is returned if 'CONNECT' was seen, '1' is returned if 'NO
- CARRIER' was seen, and '2' is returned if 'BUSY' was seen.
-
- Return TRUE.
-
- Other See mioResult.
-
-
- WSC4VB Reference Manual Page 20
-
- +---------+---------------------------------------------------------+
- | xyAbort | Aborts the XYDRIVER state driver. |
- +---------+---------------------------------------------------------+
-
- Syntax Function xyAbort(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The xyAbort Function forces the driver to IDLE, terminating
- any file transfer which may be in progress.
-
- Return XY_NO_ERROR (0).
-
-
-
-
-
-
- +-----------+-------------------------------------------------------+
- | xyAcquire | Prepares the state driver for operation. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function xyAcquire(ByVal Port) As Long
- ' Port : Port selected.
-
-
- Remark The xyAcquire Function initializes the driver for subsequent
- use. This should be the first driver Function called.
-
- Return =0 : No error (XY_NO_ERROR).
- <0 : XYDRIVER error. See XYDRIVER Error Codes.
-
- Other See xyRelease.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 21
-
- +----------+--------------------------------------------------------+
- | xyDebug | Set the driver debug level. |
- +----------+--------------------------------------------------------+
-
- Syntax Function xyDebug(ByVal DebugLevel) As Long
- ' DebugLevel : Debug level value.
-
- Remark The xyDebug Functions sets the driver debug level as follows:
-
- DebugLevel : Meaning
- 0 Only error messages are generated [default].
- 1 Minimal debug messages are generated.
- 2 Maximal debug messages are generated.
-
- Debug messages are retrieved using the xyGetMessage Function.
-
- Returns New debug level [0,1,2]
-
-
-
-
- +----------+--------------------------------------------------------+
- | xyDriver | XMODEM / YMODEM state driver. |
- +----------+--------------------------------------------------------+
-
- Syntax Function xyDriver(ByVal Port) As Long
- ' Port : Port selected.
-
- Return XY_IDLE : A transfer is not underway.
- XY_RUNNING : A transfer is underway.
-
- Remark The xyDriver Function drives the state engine. It is normally
- called within a timer loop. Note that xyDriver never returns
- an error code.
-
- xyDriver can be called as often as wanted whether or not a
- file transfer was initiated.
-
- Other See xyStartTx and xyStartRx.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 22
-
- +---------------+---------------------------------------------------+
- | xyGetFileName | Get the filename |
- +---------------+---------------------------------------------------+
-
- SYNTAX Function xyGetFileName(Buffer As string, ByVal Size)
- ' Buffer : Filename buffer.
- ' Size : Size of Filename buffer.
-
- REMARK The xyGetFileName function gets the current filename. This
- function is designed for use on the receive side YMODEM
- protocol, where the filename is received as part of the first
- packet (packet #0). See TERM.BAS for an example of use.
-
- RETURN TRUE : A message was copied into Buffer.
- FALSE : No messages are available.
-
- OTHER See xyGetParameter.
-
-
-
-
- +--------------+----------------------------------------------------+
- | xyGetMessage | Get next XYDRIVER message. |
- +--------------+----------------------------------------------------+
-
- Syntax Function xyGetMessage(Buffer As String, ByVal Size) As Long
- ' Buffer : Message buffer.
- ' Size : Size of message buffer.
-
- Remark The xyGetMessage Function retrieves the next message from the
- driver message queue. Refer to the XMR.BAS example program for
- an sample of using xyGetMessage.
-
- Return TRUE : A message was copied into Buffer.
- FALSE : No messages are available.
-
- Other See xyDebug.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 23
-
- +----------------+--------------------------------------------------+
- | xyGetParameter | Retrieves driver parameter. |
- +----------------+--------------------------------------------------+
-
- Syntax Function xyGetParameter(ByVal Port, ByVal Parameter) As Long
- ' Port : Port Selected.
- ' Parameter : Parameter to return.
-
- Remark The driver parameter corresponding to the following table is
- returned.
-
- Parameter : Description
- XY_GET_ERROR_CODE : Driver error code (see XYDRIVER.BAS)
- XY_GET_ERROR_STATE : Error state (if in error).
- XY_GET_PACKET : Current packet number.
- XY_GET_STATE : Current state (see XYDRIVER.BAS).
- XY_GET_FILE_SIZE : File size.
- XY_GET_NBR_NAKS : Number of packets ACKed.
- XY_GET_LAST_GET : Last incoming (serial) character.
- XY_GET_LAST_PUT : Last outgoing (serial) character.
- XY_GET_GET_COUNT : Number of incoming characters (bytes).
- XY_GET_PUT_COUNT : Number of outgoing characters (bytes).
- XY_GET_DRIVER_COUNT : Number times xyDriver() was called.
- -1 : Cannot recognize parameter.
-
- The xyGetParameter Function can be used to check the state of
- the driver. For example:
-
- (1) xyGetParameter(ByVal Port,XY_GET_STATE) returns XY_IDLE if idle.
- (2) xyGetParameter(ByVal Port,XY_GET_ERROR_CODE) returns the driver
- error code if an error has occurred or XY_NO_ERROR (0)
- otherwise.
-
- Return See above.
-
-
- +-----------+-------------------------------------------------------+
- | xyRelease | Releases driver port. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function xyRelease(ByVal Port) As Long
- ' Port : Port selected.
-
- Remark The xyRelease Function releases a port that was previously
- acquired with xyAcquire. This Function should be called before
- calling the WSC Function SioDone.
-
- Return 0 : No error (XY_NO_ERROR).
- <0 : XYDRIVER error. See .XYDRIVER Error Codes.
-
- Other See xyAcquire.
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 24
-
- +----------------+--------------------------------------------------+
- | xySetParameter | Retrieves driver parameter. |
- +----------------+--------------------------------------------------+
-
- SYNTAX Function xySetParameter(ByVal Port, ByVal ParmName,
- ByVal ParmValue) As Long
- ' Port : Port Selected.
- ' ParmName : Parameter Name.
- ' ParmValue : Parameter Value.
-
- REMARK The ParmValue corresponding to the following table is set.
-
- ParmName : Description
- XY_SET_NAK_RATE : Sets the prompt delay (in seconds).
- XY_SET_EOF_CHAR : Sets the XMODEM pad character.
- -1 : Cannot recognize parameter.
-
- The XY_SET_NAK_RATE parameter sets the delay (in seconds)
- between prompts that the receiver transmits to the sender to
- start the file transfer. The legal range is 1 to 10 seconds.
-
- The XY_SET_EOF_CHAR parameter sets the pad character used by
- XMODEM in padding the last packet to 128 bytes. The normal
- value is control-Z (hex 1A). For example, to set the pad
- character to zeros:
-
- Code = xySetParameter(COM1, XY_SET_EOF_CHAR, 0)
-
- +-----------+-------------------------------------------------------+
- | xyStartRx | Start XMODEM or YMODEM receive. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function xyStartRx(ByVal Port, ByVal Filename As String,
- ByVal NCGchar, ByVal Batch) As Long
- ' Port : Port to use.
- ' Filename : File to receive (XMODEM only).
- ' NCGchar : NAK or ASC("C").
- ' Batch : YMODEM flag (T/F).
-
- Remark The xyStartRx starts the XMODEM or YMODEM file receive. Once
- started, calls to xyDriver are made to execute the next state
- (or states). The xyStartTx Function returns immediately.
-
- Protocol : NCGchar BatchFlag : Comments
- XMODEM : NAK FALSE Standard XMODEM
- XMODEM/CRC : ASC("C") FALSE
- XMODEM/1K : ASC("C") FALSE
- YMODEM : ASC("C") TRUE Standard YMODEM
-
- The xyStart Function is used to receive a file using XMODEM or
- YMODEM.
-
- Return =0 : No error (XY_NO_ERROR).
- <0 : Driver error. See .XYDRIVER Error Codes. a list of errors.
-
- Other See xyStartTx and xyDriver.
-
-
- WSC4VB Reference Manual Page 25
-
- +-----------+-------------------------------------------------------+
- | xyStartTx | Start XMODEM or YMODEM transmit. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function xyStartTx(ByVal Port, ByVal Filename As String,
- ByVal OneKflag, ByVal Batch) As Long
- ' Port : Port to use.
- ' Filename : File to send.
- ' OneK : Want 1K blocks (T/F).
- ' Batch : YMODEM flag (T/F).
-
- Remark The xyStartTx starts the XMODEM or YMODEM file send. Once
- started, calls to xyDriver are made to execute the next state
- (or states). The xyStartTx Function returns immediately.
-
- Protocol : OneKflag BatchFlag : Comments
- XMODEM : FALSE FALSE Standard XMODEM
- XMODEM/CRC : FALSE FALSE
- XMODEM/1K : TRUE FALSE
- YMODEM : TRUE TRUE Standard YMODEM
-
- Return =0 : No error (XY_NO_ERROR).
- <0 : Driver error. See XYDRIVER.BAS for a list of errors.
-
- Other See xyStartRx and xyDriver.
-
- XYDRV Error Codes
-
- Error codes are always negative, except for 'no error'. Most of these
- error conditions rarely occur. Also note that XYDRV functions can
- return WSC errors. An error message is queued when an error occurs
- which can be retrieved with xyGetMessage.
-
- The numeric values for error codes can be found in XYDRV32.BAS.
-
- +--------------------------+----------------------------------------+
- | XY_NO_ERROR | No error. (0) |
- | XY_UNKNOWN_ERROR | Unknown error. |
- | XY_ALREADY_ACTIVE_ERROR | Port already acquired. |
- | XY_CANNOT_OPEN_ERROR | Cannot open specifed file. |
- | XY_EMPTY_FILE_ERROR | Specified file is empty. |
- | XY_NO_STARTUP_CHAR_ERROR | Must specify NAK or "C". |
- | XY_NOT_NCG_ERROR | Expected NAK or "C". |
- | XY_DISK_READ_ERROR | Error reading disk. |
- | XY_NO_EOT_ACK_ERROR | EOT was not ACKed. |
- | XY_INTERNAL_ERROR | Internal error! |
- | XY_CANCELLED_ERROR | Other side cancelled. |
- | XY_OUT_OF_SYNC_ERROR | Protocol has lost synchronization. |
- | XY_RETRIES_ERROR | Packet retry limit was exceeded. |
- | XY_BAD_PACKET_NBR_ERROR | Incorrect packet number. |
- | XY_TIMED_OUT_ERROR | Timed out waiting for other side. |
- | XY_NO_SUCH_FILE_ERROR | No such file. |
- | XY_NOT_ACTIVE_ERROR | Port not acquired by xyAcquire. |
- | XY_PORT_RANGE_ERROR | Port number out of range. |
- +--------------------------+----------------------------------------+
-
-
-
- WSC4VB Reference Manual Page 26
-
- +----------+--------------------------------------------------------+
- | ascAbort | Aborts the Ascii state driver. |
- +----------+--------------------------------------------------------+
-
- Syntax Function ascAbort() As Long
-
- Remark The ascAbort function forces the ASCII driver to IDLE,
- terminating any file transfer which may be in progress.
-
- Return none.
-
-
-
- +-----------+-------------------------------------------------------+
- | ascDriver | Ascii state driver. |
- +-----------+-------------------------------------------------------+
-
- Syntax Function ascDriver() As Long
-
- Return 1 : IDLE (A transfer is not underway).
- 0 : Running (A transfer is underway).
-
- Remark The ascDriver function drives the state engine. It executes
- the next driver state, and is typically called from within a
- timer loop.
-
- ascDriver can be called as often as wanted whether or not a
- file transfer was initiated. Note that ascDriver never
- returns an error code.
-
- Other See ascStartTx and ascStartRx.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 27
-
- +---------------+---------------------------------------------------+
- | ascGetMessage | Get next Ascii driver message. |
- +---------------+---------------------------------------------------+
-
- Syntax Function ascGetMessage(ByVal Buffer As String, ByVal Size)
- As Long
- ' Buffer : Message buffer.
- ' Size : Size of message buffer.
-
- Remark The ascGetMessage function retieves the next message from the
- driver message queue.
-
- Return TRUE : A message was copied into Buffer.
- FALSE : No messages are available.
-
- Other See ascGetParameter.
-
-
-
- +-----------------+-------------------------------------------------+
- | ascGetParameter | Retrieves driver parameter. |
- +-----------------+-------------------------------------------------+
-
- Syntax Function ascGetParameter(ByVal Parameter) As Long
- ' Parameter : Parameter to return.
-
- Remark The driver parameter corresponding to the following table is
- returned.
-
- Parameter : Desciption
- ASC_GET_ERROR_CODE : Driver error code (see ASCDRV.BAS)
- ASC_GET_ERROR_STATE : Error state (if in error).
- ASC_GET_STATE : Current state (ss ASCDRV.BAS).
- -1 : Cannot recognize parameter.
-
- The ascGetParameter function can be used to check the state of
- the driver. For example:
-
- (1) ascGetParameter(Port,ASC_GET_STATE) returns the current
- state.
- (2) ascGetParameter(Port,ASC_GET_ERROR_CODE) returns the driver
- error code if an error has occurred or ASC_NO_ERROR (0)
- otherwise.
-
- Return See above.
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 28
-
- +---------+---------------------------------------------------------+
- | ascInit | Start Ascii receive. |
- +---------+---------------------------------------------------------+
-
- Syntax Function ascInit(ByVal Port, ByVal RxBufSize,
- ByVal xFlag) As Long
- ' Port : Port selected.
- ' RxBufSize : RX buffer size
- ' xFlag : Perform XON/XOFF flag (T/F).
-
- Remark The ascInit initializes the Ascii driver for subsequent use.
- RxBufSize is the size of the receive buffer as passed to
- SioReset. xFlag is used to request that XON/XOFF flow control
- be performed by the Ascii driver.
-
- Return =0 : No error (ASC_NO_ERROR).
- <0 : Driver error. See "Error Codes" for a list of errors.
-
- Other See ascStartTx and ascDriver.
-
- +------------+------------------------------------------------------+
- | ascStartRx | Start Ascii receive. |
- +------------+------------------------------------------------------+
-
- Syntax function ascStartRx(ByVal FileName As String,
- ByVal TermChar, ByVal FirstWait,
- ByVal CharWait, ByVal EchoFlag) As Long
- ' Filename : File to receive
- ' TermChar : Termination character ($00 if none)
- ' FirstWait: Max seconds to wait for 1st incoming char
- ' CharWait : Max seconds between chars to wait
- ' EchoFlag : Echo to display if true
-
- Remark The ascStartRx starts the ASCII file receive. Once
- started, calls to ascDriver are made to execute the next state
- (or states). The ascStartTx function returns immediately.
-
- You may need to prompt the sender by sending a carriage return
- ($0d) or XON character ($11).
- example.
-
- Return =0 : No error (ASC_NO_ERROR).
- <0 : Driver error. See "Error Codes" for a list of errors.
-
- Other See ascStartTx and ascDriver.
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 29
-
- +------------+------------------------------------------------------+
- | ascStartTx | Start Ascii transmit. |
- +------------+------------------------------------------------------+
-
- Syntax Function ascStartTx(ByVal FileName As String,
- ByVal CharPace, ByVal TermChar,
- ByVal EchoFlag) As Long
- ' Filename : File to receive
- ' CharPace : Delay in millisecs between chars
- ' TermChar : Termination character ($00 if none)
- ' EchoFlag : Echo to display if true
-
- Remark The ascStartTx starts the Ascii file send. Once
- started, calls to ascDriver are made to execute the next state
- (or states). The ascStartTx function returns immediately.
-
- Return =0 : No error (ASC_NO_ERROR).
- <0 : Driver error. See XTDRIVER.BAS for a list of errors.
-
- Other See ascStartRx and ascDriver.
-
- ASCDRV Error Codes
-
- Error codes are always negative, except for 'no error'. Most of these
- error conditions rarely occur. Also note that ASCII DRIVER functions
- can return WSC errors. An error message is queued when an error
- occurs which can be retrieved with ascGetMessage.
-
- The numeric values for error codes can be found in AscDriver.bas.
-
- +------------------------+------------------------------------------+
- | ASC_NO_ERROR | No error. (0) |
- | ASC_NOT_ACTIVE_ERROR | ascInit not previously called. |
- | ASC_CANNOT_OPEN_ERROR | Cannot open specifed file. |
- | ASC_DISK_IO_ERROR | Error reading or writting disk. |
- | ASC_INTERNAL_ERROR | Internal error! |
- | ASC_NOT_OPEN_ERROR | File not open. |
- +------------------------+------------------------------------------+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- WSC4VB Reference Manual Page 30
-
-